<include file="Public/header" />
<div class="x12 padding-top padding border-bottom">
  <h3 class="x3">项目标签管理</h3>
  <a href="javascript:void(0)" class="adds float-right bg-sub button icon-plus" type="button" onclick="node_add()"> 添加标签</a>
</div>
<div class="x12 padding">
  <table class="table table-bordered table-hover">
    <tbody>
      <tr>
        <th>ID</th><th>标签名</th><th>操作</th>
      </tr>
      <volist name="tags" id="vo">
        <tr id="tr{$vo.id}" class="height">
          <td>{$vo.id}</td>
          <td id="trname{$vo.id}">{$vo.name}</td>
          <td>
            <button class="updates button button-small bg-sub" id="s0{$vo.id}" url="{:U('/Admin/Item/tags_edit',array('id'=>$vo['id']))}" sname="{$vo.name}">编辑</button>
            <button class="del button button-small bg-sub" sid="{$vo.id}" sname="{$vo.name}">删除</button>
          </td>
        </tr>
        <volist name="vo.lower" id="rs" key="k">
          <tr id="tr{$rs.id}" class="height">
            <td>{$rs.id}</td>
            <td id="trname{$rs.id}">├──　　{$rs.name}</td>
            <td>{$rs.pid}</td>
            <td>{$rs.sort}</td>
            <td>{$rs.create_time|date="Y-m-d H:i",###}</td>
            <td>
              <!-- <button class="update button bg-main" id="s0{$rs.id}" sid="{$rs.id}" sname="{$rs.name}">编辑</button> -->
              <button class="updates button button-small bg-sub" id="s0{$rs.id}" url="{:U('/Admin/Item/tags_edit',array('id'=>$rs['id']))}" sname="{$rs.name}">编辑</button>
              <button class="del button button-small bg-sub" sid="{$rs.id}" sname="{$rs.name}">删除</button>
            </td>
          </tr>
        </volist>
      </volist>
    </tbody>

  </table>
  <div class="margin-big-top">
    <ul class="pagination">
      {$page}
    </ul>
  </div>
</div>
<!-- 底部 -->
<include file="foot" />
<script type="text/javascript">
$(function(){
  //全局配置

  layer.config({

    extend: [

    'extend/layer.ext.js'

    ]

  });

    //添加分类

    $('.adds').click(function(){

      layer.open({

        type: 2,

        title: '添加分类',

        shadeClose: true,

        shade: 0.8,

        area: ['480px', '270px'],

        content: '{:U('/Admin/Item/tags_add')}'

      });

    });

    //修改分类

    $('.updates').click(function(){

      var url = $(this).attr('url');

      layer.open({

        type: 2,

        title: '修改分类：'+ $(this).attr('sname'),

        shadeClose: true,

        shade: 0.8,

        area: ['480px', '270px'],

        content: url

      });

    });

    //删除

    $('.del').click(function(){

      var sid = $(this).attr('sid');

      layer.confirm('确定要删除 "'+ $(this).attr('sname') +'" 吗？', {icon: 3},function(){

        $.ajax({

          type: 'POST',

          url: url,

          data:{

            id:sid

          },

          dataType: "json",

          beforeSend: function() {

            layer.closeAll();

            layer.load(2,{shade: [0.1,'#000']});

          },

          success: function(data){

            layer.closeAll();

            if (data.status == 1) {

              

              layer.msg(data.info, {

                shift: 2,

                time: 1000,

                shade: [0.1,'#000'],

                end: function(){

                  $("#tr"+sid).remove();

                }

              });

            }else{

              layer.alert(data.info,{icon: 5});

            }

          }

        });

      });

    });





  });



</script>

</body>

</html>